export default {
	data() {
		return {
		
			// 记录当前页数
			page:1,
			// 记录总页数
			allPage:null,
			status: 'loadmore',
			// 记录当前的公司cid
			companyCid:null,
			// 变更的信息
			changeMsg:[]
			
		}
	},
	onLoad(option) {
		// console.log("______________", option)
		// 查询该公司详情
		this.companyCid=option.companyCid
		this.checkChangeList(option.companyCid)

	},
	onReachBottom() {
		// console.log("-----------",this.page,this.allPage)
				if(this.page >= this.allPage) {
					this.status = 'nomore';
					return 
				}
				this.status = 'loading';
				this.page = ++ this.page;
				setTimeout(() => {
					this.checkChangeList(this.companyCid)
					if(this.page >= 3) this.status = 'nomore';
					else this.status = 'loading';
				}, 2000)
			},
	methods: {
		
		// 查询该公司变更数量
		checkChangeList(id) {
			this.$app.request({
				url: this.$baseApp.api.dicData.companyChangeRecordList,
				data: {
					'companyCid': id,
					'page':this.page
				},
				method: 'GET',
				dataType: 'json',
				success: res => {
					if (res.code == 200) {
					
						this.allPage=res.data.totalPages
						if(this.allPage==1){
							this.status = 'nomore'
						}
						res.data.content.forEach((item)=>{
							
							this.changeMsg.push(item)
						})
						
					} 
					// console.log("-------------------",this.changeMsg)
				},
				complete: res => {
					uni.stopPullDownRefresh();
					uni.hideLoading();
				}
			});
		},
	}
}
